import { Http } from '../util/http-p.js'

class BookModel extends Http {
  //获取热门书籍
  getHotList(){
   return this.request({
      url: 'book/hot_list'
    })
  }
  //获取书籍详情
  getBookDetail(id) {
    return this.request({
      url: `book/${id}/detail`
    })
  }
  //获取书籍点赞情况
  getLikeStatus(id) {
    return this.request({
      url: `book/${id}/favor`
    })
  }
  //获取书籍短评
  getShortComments(id) {
    return this.request({
      url: `book/${id}/short_comment`
    })
  }
  //添加书籍短评
  addBookComment(book_id, content){
    return this.request({
      url: 'book/add/short_comment',
      method: 'POST',
      data: {
        book_id: book_id,
        content: content
      }
    })
  }
  //书籍搜索
  searchBook(start, q) {
    return this.request({
      url: 'book/search?summary=1',
      data: {
        q: q,
        start: start
      }
    })
  }
  //获取喜欢书籍的数量
  getLikeBookNum() {
    return this.request({
      url: 'book/favor/count'
    })
  }
}
export { BookModel}